#include "WindowHelper.h"
#include "../SDLtoolkit/widgets/PlayScenarioPanel.h"
#include "../SDLtoolkit/widgets/Label.h"
#include "../SDLtoolkit/widgets/Textbox.h"
#include "../SDLtoolkit/widgets/Button.h"
#include "../SDLtoolkit/widgets/listeners/ConnectButtonListener.h"
#include "../SDLtoolkit/widgets/listeners/CreateServerButtonListener.h"
#include "../SDLtoolkit/widgets/listeners/BackButtonListener.h"

WindowHelper::WindowHelper() {
}

WindowHelper::~WindowHelper() {
}

Window* WindowHelper::playSceneWindow(SpaceBattleInterface* game) {
	Logger::log("WindowHelper", "playWindow", "Abriendo el escenario ");

	Window* playWindow = new Window(play);

	PlayScenarioPanel* panel = new PlayScenarioPanel(0, 0, playWindow, game);

	playWindow->setScenarioContainer(panel);

	return playWindow;
}
Window* WindowHelper::gameWindow() {

	Window* connectGameWindow = new Window(CONNECT);

	Label* label = new Label("Conexion:", connectGameWindow, 20, 50);
	((Container*) connectGameWindow)->add(label);

	Textbox* connectTextBox = new Textbox(120, 50, connectGameWindow);
	((Container*) connectGameWindow)->add(connectTextBox);

	Label* label2 = new Label("Jugador:", connectGameWindow, 20, 450);
	((Container*) connectGameWindow)->add(label2);

	Textbox* userNameTextBox = new Textbox(120, 450, connectGameWindow);
	((Container*) connectGameWindow)->add(userNameTextBox);

	CreateServerButtonListener* createServerButtonListener = new CreateServerButtonListener(connectTextBox);
	Button* createButton = new Button("Crear", "button", 450, 400,
			connectGameWindow, createServerButtonListener);
	((Container*) connectGameWindow)->add(createButton);

	ConnectButtonListener* connectButtonListener = new ConnectButtonListener(
			userNameTextBox, connectTextBox);
	Button* enterButton = new Button("Entrar", "button", 450, 450,
			connectGameWindow, connectButtonListener);
	((Container*) connectGameWindow)->add(enterButton);

	Button* quitButton = new Button(std::string("Atras"), std::string("button"),
			450, 500,connectGameWindow, (Listener*)new BackButtonListener());
	((Container*) connectGameWindow)->add(quitButton);

	return connectGameWindow;
}


Window* WindowHelper::exitWindow() {
	Window* exitWindow = new Window(EXIT);

	Label* label = new Label("Saliendo ...", exitWindow, 20, 50);
	((Container*) exitWindow)->add(label);

	return exitWindow;
}
